#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""健康检查API端点"""

import logging
from fastapi import APIRouter, status
from pydantic  import BaseModel

# 创建日志记录器
logger = logging.getLogger(__name__)

# 创建路由器
router = APIRouter()

# 健康状态响应模型
class HealthResponse(BaseModel):
    status: str
    version: str

@router.get(
    "/",
    response_model=HealthResponse,
    status_code=status.HTTP_200_OK,
    summary="健康检查",
    description="检查API服务是否正常运行"
)
async def health_check():
    """健康检查端点"""
    from app import __version__
    
    logger.debug("健康检查请求")
    return {
        "status": "ok",
        "version": __version__
    }